package com.lxj.controller;

import com.lxj.domain.Group;
import com.lxj.service.GroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@ResponseBody
@RequestMapping("/group")
@Controller
public class GroupController {
    @Autowired
    private GroupService groupService;

    @PostMapping("/selectAll")
    public Map<String,Object> selectAll(Group group) {
        List<Group> list = groupService.selectAll(group);
        int number = groupService.getNUmber();
        Map<String,Object> map = new HashMap<>();
        map.put("list",list);
        map.put("number",number);
        return map;
    }
    @GetMapping("/delete")
    public int delete(Integer[] id){
        return groupService.delete(id);
    }
    @GetMapping("/add")
    public int add(Group group){
        return groupService.add(group);
    }
    @PostMapping("/findById")
    private Group findById(Integer id){
        return groupService.findById(id);
    }
    @PostMapping("/edit")
    public int edit(Group group){
        return groupService.edit(group);
    }
    //用户签到新增进行权限合法查询
    @GetMapping("/confirm")
    public Group getConfirm(Group group){
        return groupService.getConfirm(group);
    }
}
